package com.zhentao.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.zhentao.model.dto.system.AssginMenuDto;
import com.zhentao.model.entity.system.SysMenu;
import com.zhentao.service.SysMenuService;
import com.zhentao.service.SysRoleMenuService;
import com.zhentao.mapper.SysRoleMenuMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
* @author 懒阳阳
* @description 针对表【sys_role_menu(角色菜单)】的数据库操作Service实现
* @createDate 2025-02-08 14:45:04
*/
@Service
public class SysRoleMenuServiceImpl implements SysRoleMenuService {

    @Autowired
    private SysMenuService sysMenuService;

    @Autowired
    private SysRoleMenuMapper sysRoleMenuMapper;

    @Override
    public Map<String, Object> findSysRoleMenuByRoleId(Long roleId) {
        //查询所有菜单数据
        List<SysMenu> sysMenuList = sysMenuService.findNodes();

        //查询当前角色的菜单数据
        List<Long> roleMenuIds = sysRoleMenuMapper.findSysRoleMenuByRoleId(roleId);

        //将数据存储到Map中进行返回
        Map<String, Object> result = new HashMap<>();
        result.put("sysMenuList",sysMenuList);
        result.put("roleMenuIds",roleMenuIds);

        //返回
        return result;
    }

    @Override
    public void doAssign(AssginMenuDto assginMenuDto) {

    }
}




